#ifndef GOBANG_H
#define GOBANG_H

#include <QMainWindow>
#include"Item.h"
#include "qmap.h"

namespace Ui {
class gobang;
}

#define CHESS_ROWS          15
#define CHESS_COLUMES       15
#define RECT_WIDTH          25
#define RECT_HEIGHT         25
class gobang : public QMainWindow
{
    Q_OBJECT

public:
    explicit gobang(QWidget *parent = 0);
    ~gobang();
    void inittime();
    int limit_time;//落子限制时间，秒
    int temp_time;//实时倒计时时间，秒
    QTimer *timer;
    int count=0;
protected:
    void paintEvent(QPaintEvent*e);
    void mousePressEvent(QMouseEvent *);
private:
    void DrawChessboard();
    void DrawItems();
    void DrawItemWithMouse();
    void DrawChessAtPoint(QPainter& painter,QPoint& pt);
    int CountItems(Item item,QPoint ptDirection);
private:
    Ui::gobang *ui;

    int t1=80000;
    QVector<Item>mItems;
    bool mIsBlackTurn;
    bool mIsWhichBg;
    QString BLACK;
    QString WHITE;
    QString str;

private slots:
    bool countdown();//时间到return true
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_3_clicked();
};

#endif // GOBANG_H
